﻿using System;

namespace ExamPreparation
{
    class ANacci
    {
        static void Main()
        {
            char[] alphabet = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};

            char first = char.Parse(Console.ReadLine());
            char second = char.Parse(Console.ReadLine());
            byte line = byte.Parse(Console.ReadLine());

            int firstValue = 0;
            int secondValue = 0;
            int sum = 0;

            int letterCount = (line * 2) - 3;
            int spaceCount = 0;

            Console.WriteLine(first);

            for (int i = 0; i < 26; i++)
            {
                if (alphabet[i] == first)
                {
                    firstValue = i+1;
                }

                if (alphabet[i] == second)
                {
                    secondValue = i+1;
                }

                sum = firstValue + secondValue;
            }

            Console.Write(alphabet[secondValue]);

            for (int i = 1; i <= letterCount; i++)
            {
                firstValue = secondValue;
                secondValue = sum;
                sum = (firstValue + secondValue) % 26;

                //Console.Write(alphabet[secondValue]);

                for (int j = 0; j < spaceCount; j++)
                {
                    Console.Write(" ");  
                }

                spaceCount++;

                Console.WriteLine(alphabet[sum]);
            }
        }
    }
}
